package com.pj.project.util;

import com.pj.utils.cache.BaseExpireMap;

import java.util.concurrent.TimeUnit;

/**
  * 进退坐席缓存
 *
 * @ClassName: SeatCache
 * @Description: 单例
 * @author: wangs
 * @date: 2017-12-25 下午2:23:21
 */
public class SeatCache extends BaseExpireMap<String, String> {
    private static SeatCache instance = null;
    static long expTime = 0L;
    static TimeUnit unit = null;
    private SeatCache(long expTime, TimeUnit unit) {
        super(expTime, unit);
    }


    public synchronized static SeatCache getInstance() {
        if (instance == null){
            if (unit == null)
                throw (new IllegalArgumentException("please call init at first"));
            instance = new SeatCache(expTime, unit);

        }
        return instance;
    }
    /**
     * 过期事件
     */
    @Override
    public void baseExpireEvent(String key, String str) {
        if(str!=null)
            System.out.println(str);; //非手动退坐席
    }

 }